package com.imooc.class17;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

//@Component
public class TestBean implements InitializingBean, DisposableBean {

    @Override
    public void destroy() throws Exception {
        System.out.println("Bean.destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("Bean.afterPropertiesSet");
    }

    @PostConstruct
    public void onInit(){
        System.out.println("Bean.onInit");
    }

    @PreDestroy
    public void onDestroy(){
        System.out.println("Bean.onDestory");
    }

    public void otherInit(){
        System.out.println("TestBean.otherInit");
    }

    public void otherDestroy(){
        System.out.println("TestBean.otherDestroy");
    }
}
